module.exports = {

  /**
   * hook
   * @param  {[type]} node 钩子点
   * @param  {[type]} data 数据
   * @return {[type]}      [description]
   */
  async hook(node, data = null) {
    const hooks = think.config('hooks');
    try {
      if (hooks[node]) {
        for (const i of hooks[node]) {
          think.logger.debug('call hook:', node, i);
          await think.service(i['serviceName'])[i['hook']](data);
          // await hooks[node][i](data);
        }
      }
    } catch (e) {
      think.logger.error(e);
    }
  }
};
